<?php

	$userid = ($_COOKIE["userid"]);
	$username= ($_COOKIE["username"]);
	$content=($_POST["content"]);
	$postid=($_POST["id"]);
	
	$mysqli = new mysqli("127.0.0.1", "root", "20155222", "lzj");
	
	if ($mysqli->connect_errno) {
	    printf("Connect failed: %s\n", $mysqli->connect_error);
	    exit();
	}
	$sql="insert replys values('$postid','$userid','$username','$content');";	
	$mysqli->query($sql);
	$sql="select * from replys where postid = $postid ;";
	if ($result = $mysqli->query($sql)) {
	for($i=0;$i<$result->num_rows;$i++){	
		$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
		current($row);
		next($row);
		$htmlstr="<div style='width:100%;'>
				<div style='font-size: 25px;width:20%; float:left'>".next($row)."</div>
				<div id='content' style='font-size: 20px;margin-left:20%;border-left-width:2px ;border-left-style:solid; border-left-color:gray; padding-left:10px' id='title'>".next($row)."</div>
			  </div>
			<hr>
			  ";
	}

	$result->close();
}
$mysqli->close();
echo $htmlstr;
?>
